<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.onketyup:某个键盘你按键被松开的时候触发 不区分字母的大小写
        document.addEventListener('keyup', function (event) {
            //console.log(event);
            console.log('onkeyup:' + event.key + '===' + event.keyCode);
        })

        //3.onkeypress: 键盘某个按键被按下时被调用，但是它不识别功能键， ctrl、shift  箭头等,但是能区分字母的大小写
        document.addEventListener('keypress', function(event) {
            console.log('onkeypress:' + event.key + '===' + event.keyCode);
        })
    </script>
</body>
</html>